package com.txunda.zhuohired.http.pst;

import com.ants.theantsgo.base.BasePresenter;
import com.ants.theantsgo.base.BaseView;
import com.txunda.zhuohired.http.Account;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/27 15:12
 * 功能描述：用户登录
 * 联系方式：jiahuanchen@126.com
 */

public class AccountPst extends BasePresenter {
    private Account account;

    public AccountPst(BaseView baseView) {
        super(baseView);
        account = new Account();
    }

    /**
     * 注册
     *
     * @param phone         手机号
     * @param code          验证码
     * @param password      密码
     * @param againpassword 确认密码
     */
    public void register(String phone, String code, String password, String againpassword) {
        baseView.showDialog();
        account.register(phone, code, password, againpassword, baseView);
    }

    /**
     * 登录
     *
     * @param phone    手机号
     * @param password 密码
     */
    public void login(String phone, String password) {
        baseView.showDialog();
        account.login(phone, password, baseView);
    }

    /**
     * 忘记密码
     *
     * @param phone         手机号
     * @param code          验证码
     * @param password      密码
     * @param againpassword 确认密码
     */
    public void forgetPassword(String phone, String code, String password, String againpassword) {
        baseView.showDialog();
        account.forgetPassword(phone, code, password, againpassword, baseView);
    }

    /**
     * 选择身份
     *
     * @param token 登陆成功之后的id
     */
    public void choose(String token) {
        baseView.showDialog();
        account.choose(token, baseView);
    }
}
